package cn.edu.bit.ss;

import java.util.Scanner;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;


public class SpiderMain {

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		String[] locations = {"applicationContext.xml"};
	      ApplicationContext ctx = new ClassPathXmlApplicationContext(locations);
	      try {	    	 
	    	  SpiderMan sm = (SpiderMan)ctx.getBean("spiderMan");//	    	 
	    	  sm.startWorking();
	    	  while(SpiderMan.isWorking()){
	    		  Scanner s = new Scanner(System.in);
	    		  String signal = s.nextLine();
	    		  if(signal.equals("STOP")){
	    			  sm.stopWorking();
	    		  }
	    	  }
	       } catch(Exception e) {
	    	   e.printStackTrace();
	       }
		}
}
